﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Config
/// </summary>
namespace Alipay.Demo
{
    public class Config
    {
        public static string alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjrEVFMOSiNJXaRNKicQuQdsREraftDA9Tua3WNZwcpeXeh8Wrt+V9JilLqSa7N7sVqwpvv8zWChgXhX/A96hEg97Oxe6GKUmzaZRNh0cZZ88vpkn5tlgL4mH/dhSr3Ip00kvM4rHq9PwuT4k7z1DpZAf1eghK8Q5BgxL88d0X07m9X96Ijd0yMkXArzD7jg+noqfbztEKoH3kPMRJC2w4ByVdweWUT2PwrlATpZZtYLmtDvUKG/sOkNAIKEMg3Rut1oKWpjyYanzDgS7Cg3awr1KPTl9rHCazk15aNYowmYtVabKwbGVToCAGK+qQ1gT3ELhkGnf3+h53fukNqRH+wIDAQAB";

        //public static string alipay_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB";
        //这里要配置没有经过PKCS8转换的原始私钥
        //自己rsa
       // public static string merchant_private_key = "MIICXAIBAAKBgQCoPYNbfM8iyWaohXeZ0D7eYLdvEeYvBlfzptJpbgqr8caNEKmuuZP2oZ0d5fP4f1z4S2rbKK9oS2Xfb9sEBfeDI/76wE78pTDn7Uzaw9owakj/9ws+NZj/UWcDElYUY4cHDy4hs5fzDQYZKEbMHTP65960W0dvx37Md8hCiW76KQIDAQABAoGACBV0k1fK6CP/P8ex+H0OGEdTaQ3WHppSbY2tfI1iC+MBJFQRoyidmHMphn8/Gsib4f5VsxQgYYWF7peEUYwr2VhU5Mh5T/fl8YQ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AKBgQChVX/zs3Dbf1iJlFiKaXdO1vUeByKsuLozrSZPrC49tnkkoeGztkP6iWlDbxXTvCt/G3BQ11iUOYoNzmGzbg9ASx/iMWc5Q6sVTA+YUL6N++JIzxLzcfWBrEBkA5pqVWpmqKQ3oYi99eh3S66oNr4SHWL2i9OeVDvmtKIN6mjdQQIDAQABAoGACjf3JcFs2YpEWlp6DTJG60h0OBWtnZEJwjIqZgt61k/Tdn2GZTKbNag0cZ/8mu+lNaTQRV6Obr0CQIOc7pd/AbLBUftn5WJhi00XDLG3LqrRAL8XjgN/rCskCMT8HLhuUy23VZMVSlMACLeXp2qlI4LG6WVuXII72C1hf567+B0CQQDNwUDgNoG85N0oWWho5n6SEkdsIdbk9VeKQRXhc7DOmUEgwbU3UbqFd3K5DmkLW5KeQEexB8VClxSEt0DV+iTHAkEAyLtHC+DtKfZnlnYfk7sslY7oKCZjt4MNh0/K5Prk6P7uZMMJ8aeZ5pUszk0slnl99cQhHI2vtkk2g3DgLwnVtwJBAIe773J6Qsg8KvGNWeWp+OGgEWHySPOuLlvUZ/zc90yzqVVUtJmT3vphPFt8eCu381dWjHTq7WTqieyrf6gpZs0CQQC1TPmBkBmFkinDq1MgAqnlN1sWkH32TScV9QrjwHyquT8mwUak/mUx78C1YN0J2Bfdt9TUTmDLOttC4tuJgM+HAkEAsasDKnhrGZxg1Xg/anV0HEdqEfNUNMjsHfiUfRI8wDPB37IheY2jalY4KHZaZgkOBxgLt9lKxJU2cDxRBXbpQA==";

        //自己rsa
        //public static string merchant_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCoPYNbfM8iyWaohXeZ0D7eYLdvEeYvBlfzptJpbgqr8caNEKmuuZP2oZ0d5fP4f1z4S2rbKK9oS2Xfb9sEBfeDI/76wE78pTDn7Uzaw9owakj/9ws+NZj/UWcDElYUY4cHDy4hs5fzDQYZKEbMHTP65960W0dvx37Md8hCiW76KQIDAQAB";
        public static string merchant_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvfGqDioqwYz0yjeLy04vL6WMFkyxuliYe9NQZwpdwuYE95UEBnl3/maYVwcA/Xt30ciWovXKcYorO3lG6J66q5lKCL28ogLnaGKap11Sk3Gjv60orK/WmuyDnzKhRxDkutZyJXHiY2trcQiX1DWp0vPWoITHL6hy3CeZtGCjeHIpm1FGDxCzFSNT7AiciVDShYmKK0Ktf01lqm72ikWg0ZPDRyYB7CrWRZcoW55u9zbD+vTTnSr40L05S36RWRPpfCOtbMvAs+FdhOu28Cdq/fxuH9BVbfhf1OGFXoGseMPPsOWOeb3mswya5toCeGmzZNBBE2cMgSz4LGxUdv8t4QIDAQAB";
       // public static string merchant_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChVX/zs3Dbf1iJlFiKaXdO1vUeByKsuLozrSZPrC49tnkkoeGztkP6iWlDbxXTvCt/G3BQ11iUOYoNzmGzbg9ASx/iMWc5Q6sVTA+YUL6N++JIzxLzcfWBrEBkA5pqVWpmqKQ3oYi99eh3S66oNr4SHWL2i9OeVDvmtKIN6mjdQQIDAQAB";
         public static string charset = "GBK";
       // public static string appId = "2015071500170801";//自己
         public static string appId = "2014100900013222";
         public static string serverUrl = "https://openapi.alipay.com/gateway.do";
        public static string signtype = "RSA2";

        public Config()
        {
            //
            // TODO: Add constructor logic here
            //

        }

        public static string getMerchantPublicKeyStr()
        {
            StreamReader sr = new StreamReader(merchant_public_key);
            string pubkey = sr.ReadToEnd();
            sr.Close();
            if (pubkey != null)
            {
              pubkey=  pubkey.Replace("-----BEGIN PUBLIC KEY-----", "");
              pubkey = pubkey.Replace("-----END PUBLIC KEY-----", "");
              pubkey = pubkey.Replace("\r", "");
              pubkey = pubkey.Replace("\n", "");
            }
            return pubkey;
        }
    }
}